package com.gec.yhzh.service.impl;

import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;
import com.gec.yhzh.service.QRService;import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;

@Service
public class QRServiceImpl implements QRService {
    //注入配置依赖
    @Resource
    QrConfig config;

    @Override
    public void generatorQRCode(Long userid, HttpServletResponse resonse) {
        //使用工具生成
        try {
            QrCodeUtil.generate(userid+"", config, "png",resonse.getOutputStream());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}